c# initialize array

225

c# initialize array -

string[] array = new string[2]; // creates array of length 2, default values
string[] array = new string[] { "A", "B" }; // creates populated array of length 2
string[] array = { "A" , "B" }; // creates populated array of length 2
string[] array = new[] { "A", "B" }; // created populated array of length 2

c# initialize array -

int[] rank = new int[5];

c# initialize array -

int[] rank = { 1, 2, 3,4,5};

c# initialize array -

int[] rank = { 1, 2, 3,4,5};

c# initialize array -

int [] rank = new int[5]  { 1,  2, 3, 4, 5};

Comments

Submit
0 Comments